package com.endurance.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: sunlin
 * @Date: 2024-04-24 11:00
 * @Version: 1.0
 * @Description: 测试Controller
 */
@RestController
public class ConsumerController {

    @Autowired
    private ProducerController producer;

    @GetMapping("/consumer1")
    // 给资源起别名，最好使用这种方式设置资源名称，解耦合
    @SentinelResource("consumer1")
    public String consumer1() {
        producer.producer();
        return "1";
    }

    @GetMapping("/consumer2")
    // 给资源起别名，最好使用这种方式设置资源名称，解耦合
    @SentinelResource("consumer2")
    public String consumer2() {
        producer.producer();
        return "2";
    }


}
